.class Ldgb/y2;
.super Ljava/lang/Object;
.source "SourceFile"


# instance fields
.field a:Ljava/io/InputStream;

.field b:Ldgb/b3;

.field c:Ldgb/c3;

.field d:Ljavax/crypto/CipherInputStream;

.field e:Ljava/util/zip/GZIPInputStream;

.field f:Ljava/io/InputStream;

.field g:Ljava/io/InputStream;


# direct methods
.method constructor <init>()V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 2
    iput-object v0, p0, Ldgb/y2;->a:Ljava/io/InputStream;

    .line 3
    iput-object v0, p0, Ldgb/y2;->b:Ldgb/b3;

    .line 4
    iput-object v0, p0, Ldgb/y2;->c:Ldgb/c3;

    .line 5
    iput-object v0, p0, Ldgb/y2;->d:Ljavax/crypto/CipherInputStream;

    .line 6
    iput-object v0, p0, Ldgb/y2;->e:Ljava/util/zip/GZIPInputStream;

    .line 7
    iput-object v0, p0, Ldgb/y2;->f:Ljava/io/InputStream;

    .line 8
    iput-object v0, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    return-void
.end method


# virtual methods
.method public a(Ljava/io/InputStream;JLjava/io/OutputStream;Ljava/security/Key;)Z
    .locals 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    :try_start_0
    const-string v0, "RSA/ECB/PKCS1Padding"

    .line 1
    invoke-static {v0}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;

    move-result-object v0

    const/4 v1, 0x2

    .line 2
    invoke-virtual {v0, v1, p5}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    const/4 v0, 0x0

    :goto_0
    move-object v6, v0

    if-nez v6, :cond_0

    const/4 p1, 0x0

    return p1

    :cond_0
    const-string p5, "AES/CFB/NoPadding"

    .line 3
    invoke-static {p5}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;

    move-result-object v7

    const/high16 p5, 0x10000

    new-array v8, p5, [B

    move-object v1, p0

    move-object v2, p1

    move-wide v3, p2

    move-object v5, p4

    .line 4
    invoke-virtual/range {v1 .. v8}, Ldgb/y2;->a(Ljava/io/InputStream;JLjava/io/OutputStream;Ljavax/crypto/Cipher;Ljavax/crypto/Cipher;[B)Z

    move-result p1

    return p1
.end method

.method public a(Ljava/io/InputStream;JLjava/io/OutputStream;Ljavax/crypto/Cipher;Ljavax/crypto/Cipher;[B)Z
    .locals 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    const/4 v0, 0x0

    if-nez p5, :cond_0

    return v0

    .line 5
    :cond_0
    iput-object p1, p0, Ldgb/y2;->a:Ljava/io/InputStream;

    .line 6
    new-instance p1, Ldgb/b3;

    iget-object v1, p0, Ldgb/y2;->a:Ljava/io/InputStream;

    invoke-direct {p1, v1}, Ldgb/b3;-><init>(Ljava/io/InputStream;)V

    iput-object p1, p0, Ldgb/y2;->b:Ldgb/b3;

    .line 7
    iput-object p1, p0, Ldgb/y2;->f:Ljava/io/InputStream;

    .line 8
    invoke-static {p1}, Ldgb/a3;->b(Ljava/io/InputStream;)Ldgb/a3$a;

    move-result-object p1

    .line 9
    iget-object v1, p0, Ldgb/y2;->f:Ljava/io/InputStream;

    invoke-static {v1}, Ldgb/v3;->b(Ljava/io/InputStream;)I

    move-result v1

    .line 10
    iget-object v2, p1, Ldgb/a3$a;->b:[B

    invoke-virtual {p5, v2}, Ljavax/crypto/Cipher;->doFinal([B)[B

    move-result-object p5

    .line 11
    new-instance v2, Ljavax/crypto/spec/SecretKeySpec;

    const-string v3, "AES"

    invoke-direct {v2, p5, v3}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V

    .line 12
    new-instance v3, Ljavax/crypto/spec/IvParameterSpec;

    invoke-static {p5}, Ldgb/a3;->a([B)[B

    move-result-object p5

    invoke-direct {v3, p5}, Ljavax/crypto/spec/IvParameterSpec;-><init>([B)V

    const/4 p5, 0x2

    .line 13
    invoke-virtual {p6, p5, v2, v3}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;)V

    add-int/lit8 v1, v1, 0x10

    int-to-long v1, v1

    sub-long/2addr p2, v1

    .line 14
    new-instance p5, Ldgb/c3;

    iget-object v1, p0, Ldgb/y2;->b:Ldgb/b3;

    invoke-direct {p5, v1, p2, p3}, Ldgb/c3;-><init>(Ljava/io/InputStream;J)V

    iput-object p5, p0, Ldgb/y2;->c:Ldgb/c3;

    .line 15
    new-instance p2, Ljavax/crypto/CipherInputStream;

    iget-object p3, p0, Ldgb/y2;->c:Ldgb/c3;

    invoke-direct {p2, p3, p6}, Ljavax/crypto/CipherInputStream;-><init>(Ljava/io/InputStream;Ljavax/crypto/Cipher;)V

    iput-object p2, p0, Ldgb/y2;->d:Ljavax/crypto/CipherInputStream;

    .line 16
    iget-boolean p1, p1, Ldgb/a3$a;->c:Z

    if-eqz p1, :cond_1

    .line 17
    new-instance p1, Ljava/util/zip/GZIPInputStream;

    iget-object p2, p0, Ldgb/y2;->d:Ljavax/crypto/CipherInputStream;

    const/16 p3, 0x2000

    invoke-direct {p1, p2, p3}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;I)V

    iput-object p1, p0, Ldgb/y2;->e:Ljava/util/zip/GZIPInputStream;

    .line 18
    iput-object p1, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    goto :goto_0

    .line 19
    :cond_1
    iput-object p2, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    .line 20
    :cond_2
    :goto_0
    :try_start_0
    iget-object p1, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    invoke-virtual {p1, p7}, Ljava/io/InputStream;->read([B)I

    move-result p1

    if-lez p1, :cond_3

    .line 21
    invoke-virtual {p4, p7, v0, p1}, Ljava/io/OutputStream;->write([BII)V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    :cond_3
    if-gtz p1, :cond_2

    .line 22
    invoke-virtual {p4}, Ljava/io/OutputStream;->close()V

    .line 23
    iget-object p1, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    invoke-virtual {p1}, Ljava/io/InputStream;->close()V

    .line 24
    iget-object p1, p0, Ldgb/y2;->b:Ldgb/b3;

    invoke-virtual {p1}, Ldgb/b3;->b()J

    move-result-wide p2

    iget-object p4, p0, Ldgb/y2;->b:Ldgb/b3;

    invoke-virtual {p4}, Ldgb/b3;->c()J

    move-result-wide p4

    invoke-static {p1, p2, p3, p4, p5}, Ldgb/a3;->a(Ljava/io/InputStream;JJ)V

    .line 25
    sget-boolean p1, Ldgb/x2;->b:Z

    if-eqz p1, :cond_4

    const-string p1, "Decode sucess. data integraty is verified."

    .line 26
    invoke-static {p1}, Ldgb/a4;->a(Ljava/lang/String;)V

    :cond_4
    const/4 p1, 0x1

    return p1

    :catchall_0
    move-exception p1

    .line 27
    invoke-virtual {p4}, Ljava/io/OutputStream;->close()V

    .line 28
    iget-object p2, p0, Ldgb/y2;->g:Ljava/io/InputStream;

    invoke-virtual {p2}, Ljava/io/InputStream;->close()V

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method
